from django.db import models

from dvadmin.utils.models import CoreModel, table_prefix

table_prefix = table_prefix + "approve_"

class BigData(CoreModel):
    order_no = models.CharField(null=True,blank=True,max_length=100,verbose_name="订单号",help_text="订单号")
    project_line_number = models.CharField(null=True,blank=True,max_length=100,verbose_name="行项目编号",help_text="行项目编号")
    order_type = models.CharField(null=True,blank=True,max_length=100,verbose_name="订单类型",help_text="订单类型")
    class_describe = models.CharField(max_length=255,null=True,blank=True,verbose_name="大类描述",help_text="大类描述")
    class_code = models.CharField(max_length=255,null=True,blank=True,verbose_name="大类编码",help_text="大类编码")
    class_2nd_describe= models.CharField(max_length=255,null=True,blank=True,verbose_name="中类描述",help_text="中类描述")
    class_2nd_code = models.CharField(max_length=255,null=True,blank=True,verbose_name="中类编码",help_text="中类编码")
    class_3rd_describe = models.CharField(max_length=255, null=True, blank=True, verbose_name="小类描述", help_text="小类描述")
    class_3rd_code = models.CharField(max_length=255, null=True, blank=True, verbose_name="小类编码", help_text="小类编码")
    good_code = models.CharField(max_length=100,null=True,blank=True,verbose_name="商品编码",help_text="商品编码")
    good_name = models.CharField(max_length=100,null=True,blank=True,verbose_name="商品名称",help_text="商品名称")
    unit_of_measurement =models.CharField(max_length=100,null=True,blank=True,verbose_name="计量单位",help_text="计量单位")
    warehouse_code =models.CharField(max_length=100,null=True,blank=True,verbose_name="仓库编码",help_text="仓库编码")
    warehouse_remark = models.CharField(max_length=255, null=True, blank=True, verbose_name="仓库备注", help_text="仓库备注")
    warehouse_evaluation_category= models.CharField(max_length=255, null=True, blank=True, verbose_name="仓库评估类别", help_text="仓库评估类别")
    order_number = models.CharField(max_length=100,null=True,blank=True,verbose_name="订单数量",help_text="订单数量")
    ex_warehouse_number =models.CharField(max_length=100,null=True, blank=True, verbose_name="出库数量", help_text="出库数量")
    return_to_warehouse_number =models.CharField(max_length=100,null=True, blank=True, verbose_name="退库数量", help_text="退库数量")
    reference_price = models.DecimalField(max_digits=9,decimal_places=3,default=0,blank=True,null=True, verbose_name="参考单价", help_text="参考单价")
    reference_total_amount = models.DecimalField(max_digits=12, decimal_places=3, default=0, blank=True, null=True,
                                          verbose_name="参考总金额", help_text="参考总金额")
    price = models.DecimalField(max_digits=9, decimal_places=3, default=0, blank=True, null=True,
                                          verbose_name="单价(含税)", help_text="单价(含税)")
    price_exclude_tax = models.DecimalField(max_digits=9, decimal_places=3, default=0, blank=True, null=True,
                                          verbose_name="单价(不含税)", help_text="单价(不含税)")
    amount= models.DecimalField(max_digits=9, decimal_places=3, default=0, blank=True, null=True,
                                          verbose_name="金额(含税)", help_text="金额(含税)")
    amount_exclude_tax= models.DecimalField(max_digits=9, decimal_places=3, default=0, blank=True, null=True,
                                          verbose_name="金额(不含税)", help_text="金额(不含税)")
    tax_rate =models.CharField(max_length=100,null=True,blank=True,verbose_name="税率(%)",help_text="税率(%)")
    tax_amount = models.DecimalField(max_digits=3, decimal_places=3, default=0, blank=True, null=True,
                                          verbose_name="税额", help_text="税额")
    company = models.CharField(max_length=100,null=True,blank=True,verbose_name="公司",help_text="公司")
    ordering_department= models.CharField(max_length=100,null=True,blank=True,verbose_name="下单部门",help_text="下单部门")
    ordering_person = models.CharField(max_length=100,null=True,blank=True, verbose_name="下单人", help_text="下单人")
    order_time = models.DateTimeField(null=True,blank=True,verbose_name="下单时间",help_text="下单时间")
    payment_department = models.CharField(max_length=100,null=True,blank=True,verbose_name="付款部门",help_text="付款部门")
    payment_type =models.CharField(max_length=100,null=True,blank=True,verbose_name="付款类型",help_text="付款类型")
    expense_type = models.CharField(max_length=100,null=True,blank=True,verbose_name="费用类型",help_text="费用类型")
    Project_Name = models.CharField(max_length=100,null=True,blank=True,verbose_name="项目名称",help_text="项目名称")
    engineering_name = models.CharField(max_length=100,verbose_name="工程名称",help_text="工程名称")
    working_face = models.CharField(max_length=100,null=True,blank=True,verbose_name="工作面",help_text="工作面")
    tunnel= models.CharField(max_length=100,null=True,blank=True,verbose_name="巷道",help_text="巷道")
    process_link = models.CharField(max_length=100,null=True,blank=True,verbose_name="过程环节",help_text="过程环节")
    lnventory_type = models.CharField(max_length=100,null=True,blank=True,verbose_name="库存类型",help_text="库存类型")
    purchase_type =models.CharField(max_length=100,null=True,blank=True,verbose_name="采购类型",help_text="采购类型")
    status = models.CharField(max_length=100,null=True,blank=True,verbose_name="状态",help_text="状态")
    completion_time= models.DateTimeField(null=True,blank=True,verbose_name="完成时间",help_text="完成时间")
    audit_flow_name = models.CharField(null=True,blank=True,max_length=100,verbose_name="审核流名称",help_text="审核流名称")
    auditor = models.CharField(null=True,blank=True,max_length=100,verbose_name="审核人",help_text="审核人")
    BG_STATUS = (
        (0,"作废"),
        (1, "待提交"),
        (2, "审批中"),
        (3, "通过"),
        (4, "驳回"),
    )
    bg_status = models.IntegerField(choices=BG_STATUS,default=1,null=True,blank=True,verbose_name="后端状态",help_text="后端状态")

    class Meta:
        db_table = table_prefix + "bg_data"
        verbose_name = "大数据表"
        verbose_name_plural = verbose_name
        ordering = ("-create_datetime",)






